package edu.unmsm.fisi.taller2.mvcdemo.dao;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import edu.unmsm.fisi.taller2.mvcdemo.model.UserBean;

public class UserDao {
	private static Map<String, UserBean> dataMap = new HashMap<String, UserBean>();
	static {
		dataMap.put("rod", new UserBean("Rod", "Johnson", "rod.jhonson@interface21.com"));
		dataMap.put("james", new UserBean("James", "Gosling", "jgosling@sun.com"));
		dataMap.put("larry", new UserBean("Larry", "Ellison", "lellison@oracle.com"));
	}
	
	public UserDao(){
	}
	
	public UserBean getUser(String userName){
		return (UserBean) dataMap.get(userName);
	}

	public List<UserBean> getAllUser() {
		List<UserBean> lista = new ArrayList<UserBean>();
		for (UserBean userBean : dataMap.values()) {
			lista.add(userBean);
		}
		return lista;
	}
}
